package java4;


import java.util.Arrays;
import java.util.Scanner;

class PersonOverride{
	private String name;
	private boolean gender;
	private int age;

	public PersonOverride(){
		this("default",1,true);
	}	
	public PersonOverride(String name,int age,boolean gender){
		this.name=name;
		this.gender=gender;
		this.age=age;
	}
	public boolean equals(PersonOverride a){
		{
		if(this.name.equals(a.name))
	    if(this.age==a.age)
	    if(this.gender==a.gender)
	    return true;
		}
		return false;
	}
	public String toString(){
		return name+"-"+age+"-"+gender;
	}
}
public class Main5 {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc=new Scanner(System.in);
		int a=sc.nextInt();
		int j=0;
		PersonOverride[]per=new PersonOverride[a];
		for(int i=0;i<per.length;i++)
			per[i]=new  PersonOverride();
        int b=sc.nextInt();
        PersonOverride[]per1=new PersonOverride[b];
        for(int s=0;s<b;s++,j++)
        {
        	PersonOverride p=new PersonOverride(sc.next(),sc.nextInt(),sc.nextBoolean());
        	per1[j]=p;
        		for(int k=j-1;k>=0;k--)
        	{
        		if(per1[j].equals(per1[k]))
        			{
        			per1[j]=null;
        			j--;
        			break;
        			}
        	}
        }
        for(int p=0;p<a;p++)
         System.out.println(per[p]);
        for(int q=0;q<j;q++)
         System.out.println(per1[q]);
        System.out.println(j);
        System.out.println(Arrays.toString(PersonOverride.class.getConstructors()));
	}

}
